#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
using namespace std;

int n = 0, mod = 0;
int inv[3000010];
void build() {
    inv[1] = 1;
    for (int i = 2; i <= n; i++) {
        inv[i] = (int)(mod - (long long)inv[mod % i] * (mod / i) % mod);
    }
}

int main() {
    scanf("%d%d", &n, &mod);
    build();
    for (int i = 1; i <= n; i++) {
        printf("%d\n", inv[i]);
    }

    return 0;
}